package com.gzsxy.excel.log.event;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @author
 * @Description: 日志监听
 * @date 2022/1/4 17:57
 */
@Slf4j
public class SysLogListener {

//    @Autowired
//    private SysLogMapper sysLogMapper;

//    @Autowired
//    @Qualifier("sdqdThreadPoolTaskExecutor")
//    private ThreadPoolTaskExecutor threadPoolTaskExecutor;



//    @Async("sdqdThreadPoolTaskExecutor") //使用自定义的线程池(执行器)
    @Async
    @Order
    @EventListener(SysLogEvent.class)
    public void saveSysLog(SysLogEvent event) {
        //日志入库操作
//        sysLogMapper.insert((SysLog) event.getSource());
    }
}
